/**
 * 面包屑内筛选按钮样式
 * 统一产品、分类、品牌页面的手机版筛选按钮样式
 */
.breadcrumb-filter-btn {
  .btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid #007bff;
    font-size: 0.875rem;
    font-weight: 500;
    color: #007bff;
    background-color: transparent;
    border-radius: 0.375rem;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
    
    &:hover,
    &:focus {
      color: #fff;
      background-color: #007bff;
      border-color: #007bff;
      box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }
    
    &:active {
      color: #fff;
      background-color: #0056b3;
      border-color: #004085;
    }
    
    i {
      font-size: 0.875rem;
    }
    
    .filter-text {
      font-size: 0.875rem;
    }
  }
  
  // 响应式调整
  @media (max-width: 575.98px) {
    .btn {
      padding: 0.25rem 0.5rem;
      font-size: 0.8125rem;
      
      i {
        font-size: 0.8125rem;
      }
      
      .filter-text {
        font-size: 0.8125rem;
      }
    }
  }
}

// 面包屑容器样式优化
.breadcrumb-wrap {
  .container {
    padding-top: 1rem;
    padding-bottom: 1rem;
    
    // 当有筛选按钮时，使用flex布局
    &.d-flex {
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 0.75rem;
      align-items: center;
      
      @media (max-width: 767.98px) {
        gap: 0.5rem;
        // 保持水平布局，但允许换行
        flex-wrap: wrap;
        justify-content: space-between;
      }
    }
    
    .breadcrumb {
      flex-wrap: wrap;
      margin-bottom: 0;
      flex: 1;
      
      @media (max-width: 767.98px) {
        margin-right: 0;
        flex: 1;
        min-width: 0; // 允许收缩
      }
      
      li {
        // 长文本处理
        a, span {
          word-break: break-word;
          hyphens: auto;
        }
        
        // 在小屏幕上缩短分隔符间距
        @media (max-width: 575.98px) {
          &:not(:last-child)::after {
            margin: 0 5px;
          }
        }
      }
    }
  }
}

/* 筛选侧边栏样式 */
.filter-sidebar {
  /* 分类菜单优化样式 */
  .category-item {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f8f9fa;

    &:hover {
      background-color: #f8f9fa;
    }
  }

  .category-link {
    font-size: 14px;
    transition: color 0.2s ease;

    &:hover {
      color: $primary !important;
    }

    &.active {
      color: $primary !important;
      font-weight: 600;
      border-radius: 4px;
    }

    i {
      font-size: 12px;
    }
  }

  .category-toggle {
    border: none;
    background: none;
    color: #6c757d;
    padding: 4px 8px;
    transition: all 0.2s ease;

    &:hover {
      background-color: #e9ecef;
      color: $primary;
    }

    i {
      font-size: 12px;
      transition: transform 0.2s ease;
    }

    &:not(.collapsed) i {
      transform: rotate(180deg);
    }
  }

  .subcategory-item {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f8f9fa;

    &:hover {
      background-color: #f8f9fa;
    }
  }

  .subcategory-link {
    font-size: 13px;
    transition: color 0.2s ease;

    &:hover {
      color: $primary !important;
    }

    &.active {
      color: $primary !important;
      font-weight: 600;
      border-radius: 4px;
    }

    i {
      font-size: 10px;
    }
  }

  .subcategory-toggle {
    border: none;
    background: none;
    color: #6c757d;
    padding: 2px 6px;
    transition: all 0.2s ease;

    &:hover {
      background-color: #e9ecef;
      color: $primary;
    }

    i {
      font-size: 10px;
      transition: transform 0.2s ease;
    }

    &:not(.collapsed) i {
      transform: rotate(180deg);
    }
  }

  .subsubcategory-item {
    transition: background-color 0.2s ease;

    &:hover {
      background-color: #f8f9fa;
    }
  }

  .subsubcategory-link {
    font-size: 12px;
    transition: color 0.2s ease;

    &:hover {
      color: $primary !important;
    }

    &.active {
      color: $primary !important;
      font-weight: 600;
      background-color: rgba($primary, 0.1);
      border-radius: 4px;
    }

    i {
      font-size: 8px;
    }
  }

  /* 手风琴项目边框移除 */
  .accordion-item {
    border: none !important;

    &:last-child {
      border-bottom: none !important;
    }
  }

  /* 双滑块价格区间样式 */
  .dual-range-slider {
    position: relative;
    height: 40px;
    margin: 20px 0;
    
    .slider-track {
      position: absolute;
      top: 50%;
      left: 0;
      right: 0;
      height: 6px;
      background: #e9ecef;
      border-radius: 3px;
      transform: translateY(-50%);
    }
    
    .slider-range {
      position: absolute;
      top: 50%;
      height: 6px;
      background: $primary;
      border-radius: 3px;
      transform: translateY(-50%);
      left: 0%;
      right: 0%;
    }
    
    .slider-thumb {
      position: absolute;
      top: 50%;
      width: 20px;
      height: 20px;
      background: $primary;
      border: 3px solid #fff;
      border-radius: 50%;
      cursor: pointer;
      transform: translate(-50%, -50%);
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
      transition: all 0.2s ease;
      z-index: 2;
      
      &:hover {
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
      }
      
      &:active {
        transform: translate(-50%, -50%) scale(1.2);
      }
      
      &.slider-thumb-min {
        left: 0%;
      }
      
      &.slider-thumb-max {
        left: 100%;
      }
    }
  }

  /* 价格输入区域样式 */
  .price-inputs-container {
    order: -1; /* 将价格输入区域移到滑块上方 */
  }

  /* 筛选项样式 */
  .form-check {
    margin-bottom: 0.5rem;

    .form-check-input {
      &:checked {
        background-color: $primary;
        border-color: $primary;
      }

      &:focus {
        border-color: rgba($primary, 0.5);
        outline: 0;
        box-shadow: 0 0 0 0.25rem rgba($primary, 0.25);
      }
    }

    .form-check-label {
      font-size: 14px;
      color: #495057;
      cursor: pointer;

      &:hover {
        color: $primary;
      }
    }
  }

  /* 卡片样式优化 */
  .card {
    border-radius: 8px;
    overflow: hidden;

    .card-header {
      border-bottom: 1px solid #e9ecef;
      padding: 1rem;

      h6 {
        font-size: 16px;
        margin-bottom: 0;
      }
    }

    .card-body {
      padding: 1rem;
    }
  }

  /* 清除筛选按钮样式 */
  .clear-filters-btn {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
    font-size: 14px;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.2s ease;

    &:hover {
      background-color: #5a6268;
      border-color: #545b62;
    }

    &:focus {
      box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5);
    }
  }

  /* 响应式样式 */
  @media (max-width: 767.98px) {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    background: #fff;
    z-index: 1050;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    padding: 1rem;

    &.show {
      transform: translateX(0);
    }
  }
}

/* 遮罩层样式 */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  display: none;
}

/* 筛选切换按钮样式 */
#toggleFilterSidebar {
  background-color: $primary;
  border-color: $primary;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.2s ease;

  &:hover {
    background-color: darken($primary, 10%);
    border-color: darken($primary, 15%);
  }

  &:focus {
    box-shadow: 0 0 0 0.2rem rgba($primary, 0.5);
  }

  i {
    margin-right: 0.5rem;
  }

  @media (min-width: 768px) {
    display: none;
  }
}